package day05;

import java.util.Scanner;

/**
 * @author Xiao
 * @date 2021/7/5
 */
public class isEvennumber_02 {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        System.out.println("请输入第一个整数：");
        int n = sc.nextInt();
        System.out.println("请输入第二个整数：");
        int m = sc.nextInt();
        System.out.println(n + "到" + m + "之间所有的奇数为：");
        printEvennumber(n, m);
    }

    private static void printEvennumber(int n, int m) {
        if (n > m) {
            int temp = n;
            n = m;
            m = temp;
        } else if (n == m) {
            if (n % 2 != 0) {
                System.out.println(n);
            } else {
                System.out.println(n + "不是奇数");
            }
        }
        for (int i = n; i <= m; i++) {
            if (i % 2 != 0) {
                System.out.println(i);
            }
        }
    }
}
